package com.shuyu.web.controller.platform;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shuyu.common.core.controller.BaseController;
import com.shuyu.common.core.domain.AjaxResult;
import com.shuyu.domain.Region;
import com.shuyu.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 8129
 */
@RestController
@RequestMapping({"/platform/region"})
@Api(tags = "省市区管理")
public class RegionController extends BaseController {

    @Resource
    private RegionService regionService;

    @GetMapping("/{id}")
    @ApiOperation("查询省市区列表")
    public AjaxResult province(@PathVariable int id) {
        return AjaxResult.success(this.regionService.list(new LambdaQueryWrapper<Region>().eq(Region::getParent,id)));
    }
}
